package com.eascs.o2o.uc.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.eascs.app.log.Logger;
import com.eascs.app.log.LoggerFactory;
import com.eascs.o2o.common.vo.ModelResult;
import com.eascs.o2o.uc.dao.impl.UserDaoImpl;
import com.eascs.o2o.uc.entity.UserEntity;
import com.eascs.o2o.uc.service.UserService;

@Service
public class UserServiceIml implements UserService {
	private Logger logger = LoggerFactory.getLogger(this.getClass());
	
	@Autowired
	UserDaoImpl userDaoImpl;

	@Override
	public ModelResult<UserEntity> queryUserEntity(UserEntity entity) {
		ModelResult<UserEntity> modelResult=new ModelResult<>();
		try {
			UserEntity model=userDaoImpl.queryUserEntity(entity);
			modelResult.withModel(model);
			return modelResult;
		} catch (Exception e) {
			logger.info("member.error.queryMemberEntity(),exception:{}", e.getMessage());
		}
		return modelResult.withError("member.error.queryMemberEntity()", "查询失败!");
	}

	@Override
	public ModelResult<UserEntity> insertUserEntity(UserEntity entity) {
		ModelResult<UserEntity> modelResult=new ModelResult<>();
		try {
			UserEntity model=userDaoImpl.insertUserEntity(entity);
			modelResult.withModel(model);
			return modelResult;
		} catch (Exception e) {
			logger.info("member.error.insertMemberEntity(),exception:{}", e.getMessage());
		}
		return modelResult.withError("member.error.insertMemberEntity()", "插入失败!");
	}
}
